# 新增数据
library(tidyverse)
library(lubridate)

filename <- "~/Documents/test.csv"
delim <- ","
table <- "日数据"

conn <- src_sqlite("~/Documents/rockontrol/合肥项目数据/合肥市项目.db")
dataset <- read_delim(file = filename ,delim = delim)

dataset %>%  mutate(日期 = as.character(日期))%>%
  select(站点名称 = 站点名称,
      日期,
      AQI,
      等级 ,
      首要污染物 ,
      PM2.5浓度 = PM2.5浓度,
      PM10浓度 = PM10浓度,
      O3浓度 = O3浓度,
      SO2浓度  = SO2浓度,
      NO2浓度 = NO2浓度,
      CO浓度 = CO浓度
      )  -> dataset
db_insert_into(con = conn$con,table = table ,values = dataset )
  

DBI::dbDisconnect(conn$con)

